refactor: extract AppCrashLogger from App.xaml.cs - #607
Conversation
Move the crash-logging sink (LogCrash + CrashLogPath) out of App.xaml.cs into a dedicated AppCrashLogger, mirroring the existing AppRunMarker. The three unhandled-exception handlers and the ShowTrayMenuPopup catch now delegate to the instance; behavior is byte-for-byte identical. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep this PR open: the branch is a focused cleanup that is not already on Canonical path: Close this PR as superseded by #493. So I’m closing this here and keeping the remaining discussion on #493. Review detailsBest possible solution: Close this PR as superseded by #493. Do we have a high-confidence way to reproduce the issue? Not applicable. This is a refactor PR, and the contributor's attached runtime screenshot shows the changed crash-logging path still appends to Is this the best way to solve the issue? Yes. The extraction is narrow, mirrors the existing Security review: Security review cleared: No security or supply-chain concern found; the diff only moves existing local crash-log writing and logger calls into a dedicated service. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against eb06fba21c44. |
|
Thanks @clawsweeper for the thorough sweep — the security pass and the runtime-proof acknowledgement are much appreciated! 🙏 One small thing on the "superseded by #493" conclusion: I think there may be a mix-up there. #493 extracted So this one isn't a duplicate of #493 — they share the @clawsweeper could you take another look when you get a chance? Happy to rebase or adjust if I'm missing something. 🙂 |
Summary
Extract the crash-logging sink out of
App.xaml.csinto a small dedicatedAppCrashLogger, mirroring the existingAppRunMarker. Pure refactor, nobehavior change.
What changed
Services/AppCrashLogger.cs: takes the crash-log path in its constructorand exposes
Log(string source, Exception? ex)— the exact body of the formerstatic
LogCrash(append tocrash.log+Logger.Error).App.xaml.cs: removed the staticCrashLogPathfield and the staticLogCrashmethod; added a_crashLoggerfield. The three unhandled-exceptionhandlers and the
ShowTrayMenuPopupcatch now delegate to it.Testing
dotnet buildclean (0 warnings, 0 errors).Proof
Forced a crash at runtime (a temporary throw on a background thread, not part
of this change) to exercise the extracted logger through
OnDomainUnhandledException.crash.logreceived the expected entry:(screenshot below)
Notes
Behavior is byte-for-byte identical: same timestamp format, same append mode,
same two-stage exception swallowing, same
Logger.Errorcalls. No locking added(the original had none).
OnProcessExit/s_runMarkerare untouched.Addresses part of #554.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com